<!DOCTYPE html>
<!--
  Copyright 2016 Google Inc. All rights reserved.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      https://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License
-->
<html class="mdl-typography">
  <head>
    <meta charset="utf-8">
    <title>MDL Radio Demo</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="assets/material-design-lite.css.js" charset="utf-8"></script>
    <style type="text/css">
      .mdl-theme--dark {
        background-color: #303030;
      }

      /* Example of manually theming a radio. In a real app, the primary color would have enough
         contrast from the dark background that this wouldn't be necessary. */
      .mdl-theme--dark .mdl-radio__native-control:checked:not(:disabled) ~ .mdl-radio__background .mdl-radio__outer-circle {
        border-color: #e91e63;
      }
      .mdl-theme--dark .mdl-radio__native-control:checked:not(:disabled) ~ .mdl-radio__background .mdl-radio__inner-circle {
        background-color: #e91e63;
      }
      .mdl-theme--dark .mdl-radio__background::before {
        background-color: #e91e63;
      }
      .mdl-theme--dark .mdl-radio.mdl-ripple-upgraded::before,
      .mdl-theme--dark .mdl-radio.mdl-ripple-upgraded::after {
        background-color: rgba(233, 31, 99, .2);
      }
    </style>
  </head>
  <body>
    <main>
      <h1>MDL Radio</h1>
      <section>
        <h2>Basic Example, No Javascript</h2>

        <div class="mdl-form-field">
          <div class="mdl-radio" data-demo-no-js>
            <input class="mdl-radio__native-control" type="radio" id="ex1-radio1" checked name="ex1">
            <div class="mdl-radio__background">
              <div class="mdl-radio__outer-circle"></div>
              <div class="mdl-radio__inner-circle"></div>
            </div>
          </div>
          <label id="ex1-radio1-label" for="ex1-radio1">Radio 1</label>
        </div>
        <div class="mdl-form-field">
          <div class="mdl-radio" data-demo-no-js>
            <input class="mdl-radio__native-control" type="radio" id="ex1-radio2" name="ex1">
            <div class="mdl-radio__background">
              <div class="mdl-radio__outer-circle"></div>
              <div class="mdl-radio__inner-circle"></div>
            </div>
          </div>
          <label id="ex1-radio2-label" for="ex1-radio2">Radio 2</label>
        </div>
      </section>

      <section>
        <h2>With Javascript</h2>
        <div class="mdl-form-field">
          <div class="mdl-radio">
            <input class="mdl-radio__native-control" type="radio" id="ex2-radio1" checked name="ex2">
            <div class="mdl-radio__background">
              <div class="mdl-radio__outer-circle"></div>
              <div class="mdl-radio__inner-circle"></div>
            </div>
          </div>
          <label id="ex2-radio1-label" for="ex2-radio1">Radio 1</label>
        </div>
        <div class="mdl-form-field">
          <div class="mdl-radio">
            <input class="mdl-radio__native-control" type="radio" id="ex2-radio2" name="ex2">
            <div class="mdl-radio__background">
              <div class="mdl-radio__outer-circle"></div>
              <div class="mdl-radio__inner-circle"></div>
            </div>
          </div>
          <label id="ex2-radio2-label" for="ex2-radio2">Radio 2</label>
        </div>
      </section>

      <section class="mdl-theme--dark">
        <h2 class="mdl-theme--text-primary-on-dark">Dark Theme</h2>

        <div class="mdl-form-field">
          <div class="mdl-radio">
            <input class="mdl-radio__native-control" type="radio" id="ex3-radio1" checked name="ex3">
            <div class="mdl-radio__background">
              <div class="mdl-radio__outer-circle"></div>
              <div class="mdl-radio__inner-circle"></div>
            </div>
          </div>
          <label id="ex3-radio1-label" for="ex3-radio1">Radio 1</label>
        </div>
        <div class="mdl-form-field">
          <div class="mdl-radio">
            <input class="mdl-radio__native-control" type="radio" id="ex3-radio2" name="ex3">
            <div class="mdl-radio__background">
              <div class="mdl-radio__outer-circle"></div>
              <div class="mdl-radio__inner-circle"></div>
            </div>
          </div>
          <label id="ex3-radio2-label" for="ex3-radio2">Radio 2</label>
        </div>
      </section>

      <section>
        <h2>Disabled</h2>

        <div>
          <div class="mdl-form-field">
            <div class="mdl-radio mdl-radio--disabled">
              <input class="mdl-radio__native-control" type="radio" id="ex4a-radio1" checked disabled name="ex4a">
              <div class="mdl-radio__background">
                <div class="mdl-radio__outer-circle"></div>
                <div class="mdl-radio__inner-circle"></div>
              </div>
            </div>
            <label id="ex4a-radio1-label" for="ex4a-radio1">Disabled Radio 1</label>
          </div>
          <div class="mdl-form-field">
            <div class="mdl-radio mdl-radio--disabled">
              <input class="mdl-radio__native-control" type="radio" id="ex4a-radio2" disabled name="ex4a">
              <div class="mdl-radio__background">
                <div class="mdl-radio__outer-circle"></div>
                <div class="mdl-radio__inner-circle"></div>
              </div>
            </div>
            <label id="ex4a-radio2-label" for="ex4a-radio2">Disabled Radio 2</label>
          </div>
        </div>
        <div class="mdl-theme--dark">
          <div class="mdl-form-field">
            <div class="mdl-radio mdl-radio--disabled">
              <input class="mdl-radio__native-control" type="radio" id="ex4b-radio1" checked disabled name="ex4b">
              <div class="mdl-radio__background">
                <div class="mdl-radio__outer-circle"></div>
                <div class="mdl-radio__inner-circle"></div>
              </div>
            </div>
            <label id="ex4b-radio1-label" for="ex4b-radio1">Disabled Radio 1</label>
          </div>
          <div class="mdl-form-field">
            <div class="mdl-radio mdl-radio--disabled">
              <input class="mdl-radio__native-control" type="radio" id="ex4b-radio2" name="ex4b" disabled>
              <div class="mdl-radio__background">
                <div class="mdl-radio__outer-circle"></div>
                <div class="mdl-radio__inner-circle"></div>
              </div>
            </div>
            <label id="ex4b-radio2-label" for="ex4b-radio2">Disabled Radio 2</label>
          </div>
        </div>
      </section>
    </main>
    <script src="assets/material-design-lite.js" charset="utf-8"></script>
    <script>
      (function(global) {
        'use strict';
        var radios = document.querySelectorAll('.mdl-radio:not([data-demo-no-js])');
        for (var i = 0, radio; radio = radios[i]; i++) {
          global.mdl.radio.MDLRadio.attachTo(radio);
        }
      })(this);
    </script>
  </body>
</html>
